package com.macro.mall.controller;

import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.Mms;
import com.macro.mall.dto.MmsRequest;
import com.macro.mall.dto.OpenDoorRecord;
import com.macro.mall.service.MmsService;
import com.macro.mall.util.RequestData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author HuangZiy
 * @version 8.0
 * @date 2021/4/26 22:35
 */
@RestController
@RequestMapping(value = "/mms/store")
public class MmsController {

    @Autowired
    private MmsService mmsService;

    @GetMapping("/list")
    public CommonResult<List<Mms>> getMms(@RequestData MmsRequest request) {
        return mmsService.getMms(request);
    }


    @PostMapping
    public CommonResult<String> addMms(@RequestBody MmsRequest request) {
        return mmsService.addMms(request);
    }

    @PutMapping("/{id}")
    public CommonResult<String> updateMms(@PathVariable Integer id, @RequestBody MmsRequest request) {
        return mmsService.updateMms(request);
    }

    @DeleteMapping("/{id}")
    public CommonResult<String> deleteMms(@PathVariable Integer id) {
        return mmsService.deleteMms(id);
    }


}
